import java.util.*;

/**
 * @author LKQ
 * @date 2022/4/7 10:30
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        int[] nums = {2, 3, 5, 7, 11};
        solution.smallestDivisor(nums, 11);
    }
    public int smallestDivisor(int[] nums, int threshold) {
        int l = 1, r = threshold;
        while (l < r) {
            int mid = (l + r) / 2;
            if(check(nums, mid, threshold)) {
                l = mid + 1;
            }else {
                r = mid;
            }
        }
        return l;
    }
    public boolean check(int[] nums, int divide, int threshold) {
        int ans = 0;
        for (int i = 0; i < nums.length; i++) {
            ans += (int) Math.ceil(nums[i] * 1.0 / divide);
        }
        return ans > threshold;
    }
}
